package com.yunhe.java.day05;

/**
 * Created by Administrator on 2017/7/25 0025.
 */
public class Arr2 {
    public static void main(String[] args) {
        int [] arr={1,4,7,3};
         zuiZhi(arr);
         int[] z=zuiZhi(arr);
        System.out.println("最小值"+z[0]+"\n"+"最大值"+z[1]+"\n"+"平均值"+z[2]);
    }
    public static int [] zuiZhi(int [] arr){
        int [] Arr1= new int[3];
        Arr1[0]=arr[0];//最小值
        Arr1[1]=arr[0];//最大值
        for(int i=0;i<arr.length;i++){
            Arr1[2]+=arr[i];
            if(Arr1[0]>arr[i]){
                Arr1[0]=arr[i];
            }
            if (Arr1[1] < arr[i]) {
                Arr1[1]=arr[i];
            }
        }
        Arr1[2]/=arr.length;
        return Arr1;
    }
}
